package com.music.controller;

import com.music.dto.Result;
import com.music.entity.MvType;
import com.music.service.MvTypeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Classname MvTypeController
 * @Description TODO
 * @Version 1.0.0
 * @Date 2022/7/4 13:13
 * @Created by Administrator
 */
@RestController
@Slf4j
@RequestMapping("/mvType")
public class MvTypeController {

    @Autowired
    private MvTypeService mvTypeService;

    @GetMapping
    public Result getAllMvType() {
        Result result = new Result();
        List<MvType> mvTypeList = mvTypeService.getAllMvType();
        if (!mvTypeList.isEmpty()) {
            result.ok(mvTypeList);
        } else {
            result.fail(0, "没有相关数据");
        }
        return result;
    }
}
